package com.taiji.workOrder.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.taiji.common.annotation.Excel;
import com.taiji.common.core.domain.BaseEntity;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * @author a22999
 * @since 2023/07/01 10:17
 * description: 通知消息表
 */
public class Message extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /** 主键id */
    private String id;

    /**
     * 标题
     */
    @Excel(name = "标题")
    private String title;

    /** 发送人姓名 */
    @Excel(name = "发送人姓名")
    private String fromName;

    /** 接收人姓名 */
    @Excel(name = "接收人姓名")
    private String toName;

    /** 消息内容 */
    @Excel(name = "消息内容")
    private String content;

    /** 发送时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "发送时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date sendTime;

    /** 消息状态(0-未读,1-已读) */
    @Excel(name = "消息状态(0-未读,1-已读)")
    private Integer status;

    /** 项目代码 */
    @Excel(name = "项目代码")
    private String projectCode;

    /** 服务器名称 */
    @Excel(name = "服务器名称")
    private String serverName;

    /** 信息类型(完成 延时 转单 关闭) */
    @Excel(name = "信息类型(完成 延时 转单 关闭)")
    private String infoType;



    public void setId(String id)
    {
        this.id = id;
    }

    public String getId()
    {
        return id;
    }
    public void setFromName(String fromName)
    {
        this.fromName = fromName;
    }

    public String getFromName()
    {
        return fromName;
    }
    public void setToName(String toName)
    {
        this.toName = toName;
    }

    public String getToName()
    {
        return toName;
    }
    public void setContent(String content)
    {
        this.content = content;
    }

    public String getContent()
    {
        return content;
    }
    public void setSendTime(Date sendTime)
    {
        this.sendTime = sendTime;
    }

    public Date getSendTime()
    {
        return sendTime;
    }
    public void setStatus(Integer status)
    {
        this.status = status;
    }

    public Integer getStatus()
    {
        return status;
    }
    public void setProjectCode(String projectCode)
    {
        this.projectCode = projectCode;
    }

    public String getProjectCode()
    {
        return projectCode;
    }
    public void setServerName(String serverName)
    {
        this.serverName = serverName;
    }

    public String getServerName()
    {
        return serverName;
    }
    public void setInfoType(String infoType)
    {
        this.infoType = infoType;
    }

    public String getInfoType()
    {
        return infoType;
    }
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Override
    public String toString() {
        return "Message{" +
                "id='" + id + '\'' +
                ", title='" + title + '\'' +
                ", fromName='" + fromName + '\'' +
                ", toName='" + toName + '\'' +
                ", content='" + content + '\'' +
                ", sendTime=" + sendTime +
                ", status=" + status +
                ", projectCode='" + projectCode + '\'' +
                ", serverName='" + serverName + '\'' +
                ", infoType='" + infoType + '\'' +
                '}';
    }

    public static Message getMessage(MessageBody messageBody){
        Message message = new Message();
        message.setId(messageBody.getId());
        message.setFromName(messageBody.getFromName());
        message.setToName(messageBody.getToName());
       //message.setContent(messageBody.getContent());
        message.setSendTime(messageBody.getSendTime());
        message.setStatus(0);
        return message;
    }
}
